package com.zf.lease.domain;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zf.apartment.domain.Room;
import com.zf.common.annotation.Excel;
import com.zf.common.core.domain.BaseEntity;
import com.zf.system.domain.Customer;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 预约信息对象 order_msg
 *
 * @author ruoyi
 * @date 2024-10-08
 */
@TableName(resultMap = "com.zf.lease.mapper.OrderMsgMapper.OrderMsgResult")
public class OrderMsg extends BaseEntity{
    private static final long serialVersionUID = 1L;

    /** 前端用户ID */
    @Setter
    @Getter
    @TableId(value = "customer_id",type = IdType.AUTO)
    private Long customerId;

    /** 房间ID */
    @Getter
    private Long roomId;

    /** 预约时间 */
    @Getter
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "预约时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date orderTime;

    /** 预约状态 */
    @Getter
    @Excel(name = "预约状态")
    private String orderStatus;

    /** 客户对象 */
    @Getter
    @TableField(exist = false)
    private Customer customer;

    /** 房间对象 */
    @Setter
    @TableField(exist = false)
    private Room room;

    /** 客户联系电话 */
    @TableField(exist = false)
    private String phonenumber;
    /** 客户姓名 */
    @TableField(exist = false)
    private String customerName;
    /** 房间名称 */
    @TableField(exist = false)
    private String roomName;

    /** 新增的字段：公寓ID */
    @Getter
    @Setter
    private Long flatsId;

    /** 新增的字段：公寓名称 */
    @Getter
    @Setter
    private String flatsName;

    /** 新增的字段：公寓联系电话 */
    @Getter
    @Setter
    private String flatsPhoneNumber;


    public Long getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }

    public Long getRoomId() {
        return roomId;
    }

    public void setRoomId(Long roomId) {
        this.roomId = roomId;
    }

    public Date getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(Date orderTime) {
        this.orderTime = orderTime;
    }

    public String getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(String orderStatus) {
        this.orderStatus = orderStatus;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public Room getRoom() {
        return room;
    }

    public void setRoom(Room room) {
        this.room = room;
    }

    public String getPhonenumber() {
        return phonenumber;
    }

    public void setPhonenumber(String phonenumber) {
        this.phonenumber = phonenumber;
    }

    // 新增的 getRoomName 方法
    public String getRoomName() {
        return room != null ? room.getRoomName() : null;
    }

    // 新增的 getCustomerName 方法
    public String getCustomerName() {
        return customer != null ? customer.getCustomerName() : null;
    }

    // 为了支持可能的设置操作，我们也添加相应的 setter 方法
    public void setRoomName(String roomName) {
        if (room == null) {
            room = new Room();
        }
        room.setRoomName(roomName);
    }

    public void setCustomerName(String customerName) {
        if (customer == null) {
            customer = new Customer();
        }
        customer.setCustomerName(customerName);
    }

    public Long getFlatsId() {
        return flatsId;
    }

    public void setFlatsId(Long flatsId) {
        this.flatsId = flatsId;
    }

    public String getFlatsName() {
        return flatsName;
    }

    public void setFlatsName(String flatsName) {
        this.flatsName = flatsName;
    }

    public String getFlatsPhoneNumber() {
        return flatsPhoneNumber;
    }

    public void setFlatsPhoneNumber(String flatsPhoneNumber) {
        this.flatsPhoneNumber = flatsPhoneNumber;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("customerId", getCustomerId())
            .append("roomId", getRoomId())
            .append("orderTime", getOrderTime())
            .append("orderStatus", getOrderStatus())
            .append("customerName", getCustomerName())
            .append("roomName", getRoomName())
            .append("phoneNumber", getPhonenumber())
            .append("flatsId", getFlatsId()) // 新增字段
            .append("flatsName", getFlatsName()) // 新增字段
            .append("flatsPhoneNumber", getFlatsPhoneNumber()) // 新增字段
            .toString();
    }
}